package com.geeklan.smart.ui.dialog;

import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;

import androidx.annotation.NonNull;

import com.geeklan.smart.R;
import com.geeklan.smart.databinding.DialogContentDeviceUpdateBinding;
import com.geeklan.smart.databinding.DialogContentEdittextBinding;

public class DeviceUpdateAlertDialog extends BaseAlertDialog<DialogContentDeviceUpdateBinding> {

    public DeviceUpdateAlertDialog(@NonNull Context context, String title) {
        super(context);
        setTitle(title);
        setTopCloseButtonVisibility(true);
    }

    @Override
    protected DialogContentDeviceUpdateBinding getContentViewBinding(LayoutInflater inflater) {
        return DialogContentDeviceUpdateBinding.inflate(inflater);
    }

    public void setVersion(String version,long fileSize){
        float fileSizeInMB = fileSize / 1000f / 1000f;
        String formattedSize = String.format("%.1f", fileSizeInMB);

        mBinding.tvVersion.setText(String.format(getContext().getString(R.string.dialog_version),version,formattedSize));
    }
}
